<extend name="Base/common"/>
<block name="style">
    <style type="text/css">
        .weui-cell_access .weui-cell__ftnone:after{border-style:none;}
    </style>
</block>
<block name="body">
    <form class="formtijiao" action="" method="post">
        <div class="content">
            <div class="login-register clearfix">
                <ul class="register-kk">
                    <li><em>绑定号码</em><span class="list-txt-r">{$mobile}</span>
                    <input type="hidden" name="username" class="username" value="{$mobile}"></li>

                    <li><em>服务密码</em><input type="password" name="password" placeholder="请输入运营商服务密码" class="register-sh password" /><span class="regt-yzm1"><a class="regt-yzm1" href="{:U('Article/detail?id=4')}">忘记密码</a></span></li>
                </ul>

                 <div id="captcha" style="display: none" class="weui-cell">
                    <div class="weui-cell__hd">
                        <label class="weui-label">验证码</label>
                    </div>
                    <div class="weui-cell__bd">
                        <input class="weui-input captcha" name="captcha" placeholder="请输入验证码" type="number">
                        <input type="hidden" name="token" class="token">
                    </div>

                </div>
                <p class="login-tips"><input type="checkbox" class="chex xuexin" checked /> 我同意<span><a href="{:U('Article/detail?id=1')}">《借款服务与隐私协议》</a></span></p>
                <p class="login-tips"><input type="checkbox" class="chex reginfo" checked/> 我同意<span><a href="{:U('Article/detail?id=3')}">《信息收集与使用规则》</a></span></p>
                
                <input type="button"  value="下一步" class="login-btn" />
                <p class="login-tips"><em>温馨提示</em>：<br>1、请使用本人实名验证手机号（使用满6个月）<br>
                2、登陆成功后将收到运营商通知，均需回复</p>
            </div>

</div>

    </form>
</block>
<block name="script">
    <script >


        Zepto(function($){
            $('.login-btn').click(function(){
                var username = $('.username').val();
                var password = $('.password').val();
                var token    = $('.token').val();
                var captcha  = $('.captcha').val();
                if(password==''){
                    popup.alert('服务密码不能为空');return false;
                }
                if(!$('.xuexin').is(':checked')) {
                    popup.alert('请同意借款服务与隐私协议');return false;
                }
                if(!$('.reginfo').is(':checked')) {
                    alert('请同意信息收集及使用规则');return false;
                }

                app.AjaxSubmit('.formtijiao',function(data){
                    if(data.status==true){
                        popup.alert(data.info,data.url);
                    }else{
                        // 进入这个地方，存下token
                        if(data.captcha==true){
                            $('#captcha').show();$('.captcha').val('');
                            $('.token').val(data.token);
                            popup.alert(data.info);return false;
                        }
                        if(data.url!='' && data.url!=undefined){
                            popup.alert(data.info,data.url);return false;
                        }


                        if(data.token!=undefined){  //task返回到这
                            // popup.alert(data.token)
                            popup.loading(' 正在受权中，请稍后...');
                            var data2 = {token:data.token,url:"<php>echo U('mobileinfo');</php>"};
                            app.token(data2,"<php>echo U('Router/mobiletoken');</php>");
                            return false;
                        }else{
                            popup.alert(data.info);return false;
                        }
                    }
                });




            });


        });

    </script>

</block>